home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Graphics
/
GraphicsWorkshop
/
Source
/
Converters
/
xbm.h
< prev
next >
Wrap
Text File
|
1992-05-11
|
6KB
|
183 lines
/*
* XBM Converter
*
* Supports: init, free, readFromStream:from, write:toStream:from, getFormatName.
*
* Reads and writes XBM files as defined by the X constortium.
*/
#ifndef __XBMCONVERT__
#define __XBMCONVERT__
#import <Converter.h>
#define CONVERT_ERR_NONE 0
#define CONVERT_ERR_WARNING 1
#define CONVERT_ERR_FATAL 2
#define ERROR_NO_ERROR 0
#define ERROR_UNABLE_TO_OPEN 1
#define ERROR_PERMISSION_DENIED 2
#define ERROR_BAD_FORMAT 3
#define ERROR_TRUNCATED_FILE 4
#define ERROR_NEEDSWINDOWSERV 5
#define ERROR_UNABLETOLINK 6
#define ERROR_UNKNOWN 7
@interface XBM : Converter
{
}
/*
* Initializes the object.
* Assumes: Nothing
* Returns: self
* Results: In this converter, no action is taken.
*/
- init;
/*
* Frees nothing.
* Assumes: Object has been instantiated.
* Results: It is no longer valid to message the object.
*/
- free;
/*
* Reads an xbm file from stream.
* Assumes: The object has been instantiates, stream is an valid stream opened for at least
* reading. Sender is the id of whatever object is calling the converter. It also
* assumes that stream points to a valic XBM file, however, it won't stress if
* it can't read the file.
* Returns: id of an NXBitmapImageRep or nil if the image was unable to be read.
*/
- readFromStream: (NXStream *)stream from: sender;
/*
* Write the bitmaps id to stream.
* Assumes: Object has been instantiated. At times, it's best to have used a call to the
* save panel first, since this can set internal variables, but it's not necessary.
* stream should be a valid NXStream opened for at least writing. Sender should
* be the id of the caller. id is a NXBitmapImageRep, or something that responds
* to all the message of the NXBitmapImageRep.
* Returns: YES if the image was sucessfully writing, otherwise it returns NO.
* Results: On success, a valid XBM file is written to the output stream.
*/
- (BOOL)write: (id)image toStream: (NXStream *)stream from: sender;
/*
* Reads nothing. Not supported in this module.
* Assumes: Object instantiated.
* Returns: nil
*/
- readAllFromStream: (NXStream *)stream from: sender;
/*
* Write nothing. Not supported in this module.
* Assumes: Object instantiates.
* Returns: NO
*/
- (BOOL)writeAll: (id)image toStream: (NXStream *)stream;
/*
* Nothing created in this module.
* Assumes: Object instantiated.
* Returns: nil
*/
- customSaveView: (int)width;
/*
* This is very similar to customSaveView, however, it is used to set parameters for
* the run time loading of images. This object does not support input custom views.
* Assumes: Object instantiated and the window server is running. width should be the
* maximum width the custom view can be.
* Returns: id of a parent view or nil if this object doesn't use one.
*/
- customOpenView: (int)width;
/*
* Returns the name of the current format.
* Assumes: Object has been instantiated.
* Returns: A pointer to the string, "X11 Portable Bitmap (XBM)". The caller should
* always use something like strcpy to get a copy of the string, since it's life
* is only guaranteed for the life of the object.
*/
- (char *)getFormatName;
/*
* Does nothing in this module.
* Assumes: The converter is instantiated.
* Returns: NO
*/
- (BOOL)setCustomParameter: (const char *)parameter withValue: (void *)ptr;
/*
* Does nothing under this converter.
* Assumes: The converter is instantiate.
* Returns: NO
*/
- (void *)getCustomParameter: (const char *)parameter;
/*
* Returns a string with copyright information, name of the author, where the author
* can be reached, etc. This should only be a couple of lines, so keep it short and
* sweet. An example might be:
* "My Image Format Converter\nby Joe Programmer\nCopyright R'N'R Software\n ...
* ... email bugs to jprogramm@system.there.edu"
* Assumes: Converter linked and instantiated.
* Returns: A pointer to a null terminated string. This string must be non volatile for
* the life of the converter. Ie, as long as the programmer keeps a converter
* linked, the pointer should be valid.
*/
- (char *)copyrightNotice;
/*
* Returns the current error state of the converter.
* Assumes: Converter has been instantiated.
* Returns: 0 = CONVERT_ERR_NONE Signals no error
* 1 = CONVERT_ERR_WARNING Signals action taken, but not one expected.
* 2 = CONVERT_ERR_FATAL Signals no action taken.
*/
- (int)errorState;
/*
* Returns an int describing the current error message.
* Assumes: Converter instantiated.
* Returns: An int describing the error type. See defines for integers returned.
*/
- (int)errorMessage;
/*
* This provides support for non standard error messages. It's preferable for programmers
* to avoid this message, but in special cases where you need to express something unique,
* it is appropiate. Just remember, that the use of this message disables multilingual
* support.
* Assumes: Converter Instantiated
* Returns: NULL terminated string describing the error.
*/
- (char *)errorStringMessage;
/*
* This method returns YES if the converter requires the window server. Ideally, converters
* should not depend on the window server, but sometimes this cannot be avoided. For
* example, a programmer wouldn't be expect to write a PostScript interpreter just to read
* in eps files. Note, however, that returning YES will result in the converter not working
* with command line versions of applications.
* Assumes: Converter Instantiated
* Returns: YES is window server is needed, NO otherwise.
*/
- (BOOL)needsWindowServer;
/*
* Returns a string in the form <major version>.<minor version>. This is used by
* the calling program to see what level or protocol the object will respond to.
* Assumes: Converter instantiated.
* Returns: A null terminated string in the form <major version>.<minor version>.
* For example, 1.0.
*/
- (char *)protocolVersion;
@end
#endif